home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / resetty.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  2.0 KB  |  69 lines

  1. #include <string.h>
  2. #define    CURSES_LIBRARY    1
  3. #include <curses.h>
  4. #undef    resetty
  5.  
  6. #ifdef PDCDEBUG
  7. char *rcsid_resetty = "$Header: C:\CURSES\portable\RCS\resetty.c 2.1 1993/06/18 20:20:54 MH Rel MH $";
  8. #endif
  9.  
  10.  
  11.  
  12.  
  13. /*man-start*********************************************************************
  14.  
  15.   resetty()    - save/restore terminal modes
  16.  
  17.   X/Open Description:
  18.      These routines save and restore the state of the terminal modes.
  19.      The savetty() function saves the current state in a buffer and
  20.      resetty() restores the state to what it was at the last call to
  21.      savetty().
  22.  
  23.   PDCurses Description:
  24.      FYI: It is very unclear whether this is a duplication of the
  25.      reset_prog_mode() and reset_shell_mode() functions or whether
  26.      this is a backing store type of operation.  At this time, they
  27.      are implemented similar to the reset_*_mode() routines.
  28.  
  29.   X/Open Return Value:
  30.      The resetty() function returns OK upon success otherwise ERR is
  31.      returned.
  32.  
  33.   Portability:
  34.      PDCurses    int resetty( void );
  35.      X/Open Dec '88    int resetty( void );
  36.      SysV Curses    int resetty( void );
  37.      BSD Curses    int resetty( void );
  38.  
  39. **man-end**********************************************************************/
  40.  
  41. int    resetty(void)
  42. {
  43. #ifdef PDCDEBUG
  44.     if (trace_on) PDC_debug("resetty() - called\n");
  45. #endif
  46.  
  47. #ifndef UNIX
  48.     if    (c_save_tty.been_set == TRUE)
  49.     {
  50.         memcpy(&_cursvar, &c_save_tty.saved, sizeof(SCREEN));
  51.  
  52.         mvcur(0, 0, c_save_tty.saved.cursrow, c_save_tty.saved.curscol);
  53.         if (PDC_get_ctrl_break() != c_save_tty.saved.orgcbr)
  54.             PDC_set_ctrl_break(c_save_tty.saved.orgcbr);
  55.         if (c_save_tty.saved.raw_out)
  56.             raw();
  57.         if (c_save_tty.saved.visible_cursor)
  58.             curson();
  59.         _cursvar.font = PDC_get_font();
  60.         PDC_set_font(c_save_tty.saved.font);
  61.         if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(), c_save_tty.saved.scrnmode))
  62.             PDC_set_scrn_mode(c_save_tty.saved.scrnmode);
  63.  
  64.         PDC_set_rows(c_save_tty.saved.lines);
  65.     }
  66. #endif
  67.     return( c_save_tty.been_set ? OK : ERR );
  68. }
  69.